package com.example.springbootdemo.wx;

import org.springframework.web.client.RestTemplate;

public class AccessTokenUtil {


    public AccessToken getAccessToken(){
        RestTemplate template = new RestTemplate();
        AccessToken accessToken = new AccessToken();
        String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";

        String token = template.getForObject(url, String.class);
        accessToken.setAccess_token(token);
        System.out.println(accessToken);

         return accessToken;
    }


}
